import { handleServiceI18n } from '@/service/i18n'
export default {
  data() {
    const _this = this
    return {
      managerList: [
        {
          label: 'SERVICE_NAME',
          prop: 'bizName',
          fixed: 'left',
          width: 200,
          configType: 'default'
        },
        {
          label: 'BIZ_LEVEL',
          prop: 'bizLevel',
          sortable: 'custom',
          tips: 'BIZ_LEVEL_TIPS',
          width: 160,
          configType: 'default',
          formatter(row) {
            return _this.dictMap.BIZ_LEVEL[row.bizLevel]
          }
        },
        {
          label: 'SERVICE_STATUS',
          prop: 'bizStatus',
          width: 120,
          configType: 'default',
          formatter(row) {
            return _this.dictMap.BIZ_STATUS[row.bizStatus]
          }
        },
        {
          label: 'SERVICE_CODE',
          prop: 'resourceCodeName',
          width: 200,
          tips: 'SERVICE_CODE_TIPS',
          configType: 'extend'
        },
        {
          label: 'A_END_REGIONAL_STATION_NAME',
          prop: 'startStationName',
          width: 200
        },
        {
          label: 'A_END_ROOM_NAME',
          prop: 'startRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ANODE',
          prop: 'startNode.nodeName',
          width: 200
        },
        {
          label: 'A_END_NODE_PORT',
          prop: 'startPortbizName',
          width: 260,
          formatter(row) {
            return row.bizChannelList
              .map(i => (i.startPort ? handleServiceI18n(i.startPort.bizName) : ''))
              .join('/')
          }
        },
        {
          label: 'Z_END_REGIONAL_STATION_NAME',
          prop: 'endStationName',
          width: 200
        },
        {
          label: 'Z_END_ROOM_NAME',
          prop: 'endRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ZNODE',
          prop: 'endNode.nodeName',
          width: 200
        },
        {
          label: 'Z_END_NODE_PORT',
          prop: 'endPortbizName',
          width: 260,
          formatter(row) {
            return row.bizChannelList
              .map(i => (i.endPort ? handleServiceI18n(i.endPort.bizName) : ''))
              .join('/')
          }
        },
        {
          label: 'IS_RECOVERY_AUTO',
          prop: 'isAutoRestore',
          width: 150,
          tips: 'IS_RECOVERY_AUTO_TIPS',
          formatter(row) {
            return row.isAutoRestore ? _this.$t('OK_YES') : _this.$t('OK_NO')
          },
          configType: 'extend'
        },
        {
          label: 'LINK_DETECTION',
          prop: 'isOtdrTest',
          width: 170,
          tips: 'LINK_DETECTION_TIPS',
          formatter(row) {
            return row.isOtdrTest ? _this.$t('OK_YES') : _this.$t('OK_NO')
          },
          configType: 'extend'
        },
        {
          label: 'BUCKUP_NUM',
          prop: 'backNumber',
          width: 140,
          tips: 'BUCKUP_NUM_TIPS',
          configType: 'extend'
        },
        {
          label: 'CREATION_TIME',
          prop: 'createTime',
          width: 200,
          sortable: 'custom'
        }
      ],
      backupList: [
        {
          label: 'SERVICE_NAME',
          prop: 'bizName',
          fixed: 'left',
          width: 200,
          configType: 'default'
        },
        {
          label: 'BUCKUP_NUM',
          prop: 'backNumber',
          width: 125,
          tips: 'BUCKUP_NUM_TIPS',
          configType: 'default'
        },
        {
          label: 'SERVICE_CODE',
          prop: 'resourceCodeName',
          width: 200,
          tips: 'SERVICE_CODE_TIPS',
          configType: 'extend'
        },
        {
          label: 'SERVICE_STATUS',
          prop: 'bizStatus',
          width: 120,
          formatter(row) {
            return _this.dictMap.BIZ_STATUS[row.bizStatus]
          }
        },
        {
          label: 'A_END_REGIONAL_STATION_NAME',
          prop: 'startStationName',
          width: 200
        },
        {
          label: 'A_END_ROOM_NAME',
          prop: 'startRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ANODE',
          prop: 'startNode.nodeName',
          width: 200
        },
        {
          label: 'A_END_NODE_PORT',
          prop: 'startPortbizName',
          width: 260,
          formatter(row) {
            return row.bizChannelList
              .map(i => (i.startPort ? handleServiceI18n(i.startPort.bizName) : ''))
              .join('/')
          }
        },
        {
          label: 'Z_END_REGIONAL_STATION_NAME',
          prop: 'endStationName',
          width: 200
        },
        {
          label: 'Z_END_ROOM_NAME',
          prop: 'endRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ZNODE',
          prop: 'endNode.nodeName',
          width: 200
        },
        {
          label: 'Z_END_NODE_PORT',
          prop: 'endPortbizName',
          width: 260,
          formatter(row) {
            return row.bizChannelList
              .map(i => (i.endPort ? handleServiceI18n(i.endPort.bizName) : ''))
              .join('/')
          }
        }
      ],
      tableHeader: []
    }
  },
  created() {
    if (this.pageName === 'manager') {
      this.tableHeader = this.managerList
    } else {
      this.tableHeader = this.backupList
    }
  }
}
